package com.sky.skyopsserver.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 通知信息表
 * @TableName notification
 */
@TableName(value ="notification")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Notification implements Serializable {
    /**
     * 主键唯一ID
     */
    @TableId(value = "id")
    private Long id;

    /**
     * 名称
     */
    @TableField(value = "name")
    private String name;

    /**
     * 通知方式
     */
    @TableField(value = "type")
    private String type;

    /**
     * 邮箱收件人
     */
    @TableField(value = "target_email")
    private String targetEmail;

    /**
     * 备注
     */
    @TableField(value = "remark")
    private String remark;

    /**
     * 创建时间
     */
    @TableField(value = "create_time")
    private LocalDateTime createTime;

    /**
     * 钉钉_webhook
     */
    @TableField(value = "webhook_ding")
    private String webhookDing;

    /**
     * 微信_webhook
     */
    @TableField(value = "webhook_wx")
    private String webhookWx;

    @Serial
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Notification other = (Notification) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
            && (this.getTargetEmail() == null ? other.getTargetEmail() == null : this.getTargetEmail().equals(other.getTargetEmail()))
            && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getWebhookDing() == null ? other.getWebhookDing() == null : this.getWebhookDing().equals(other.getWebhookDing()))
            && (this.getWebhookWx() == null ? other.getWebhookWx() == null : this.getWebhookWx().equals(other.getWebhookWx()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getTargetEmail() == null) ? 0 : getTargetEmail().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getWebhookDing() == null) ? 0 : getWebhookDing().hashCode());
        result = prime * result + ((getWebhookWx() == null) ? 0 : getWebhookWx().hashCode());
        return result;
    }

    @Override
    public String toString() {
        return getClass().getSimpleName() +
                " [" +
                "Hash = " + hashCode() +
                ", id=" + id +
                ", name=" + name +
                ", type=" + type +
                ", targetEmail=" + targetEmail +
                ", remark=" + remark +
                ", createTime=" + createTime +
                ", webhookDing=" + webhookDing +
                ", webhookWx=" + webhookWx +
                ", serialVersionUID=" + serialVersionUID +
                "]";
    }
}